﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using TaskManager;

namespace SimpleHttpServer
{
    public class HttpHandleJob : IJob
    {
        public HttpListenerContext Context { get; set; }

        public Route<HttpActionInfo> HttpRoute { get; set; }

        public void Do()
        {
            try { DoOnTry(); } finally { }
        }

        public void DoOnTry()
        {
            if (HttpRoute == null)
                throw new Exception("not found http route");

            // 路由解析
            var Request = Context.Request;
            var Response = Context.Response;

            // 回写数据
            using (Response.OutputStream)
            {
                //HttpRoute.Find();
            }
        }
    }
}
